package exception;

import org.springframework.http.HttpStatus;
/**
 * @Author:CJJ
 * 状态码
 * @Date:2025/4/11
 */
public class DpException extends Exception{
    private static  final long serialVersionUID = 1L;

    /**
     * 状态代码
     */
    private String statusCode;

    /**
     * 提示信息
     */
    private String message;

    /**
     * 响应状态码
     */
    private HttpStatus httpStatus=  HttpStatus.OK;

    public DpException(String statusCode, String message) {
        this.statusCode = statusCode;
        this.message = message;
    }

    public DpException(final String statusCode, String message, HttpStatus httpStatus) {
        this.statusCode = statusCode;
        this.message = message;
    }
    public DpException(final  String statusCode, String message, HttpStatus httpStatus, Throwable cause) {
        super(cause);
        this.statusCode = statusCode;
        this.message = message;
        this.httpStatus = httpStatus;
    }

    public DpException(final StatusCode statusCode, final String message,final Throwable cause){
        super(cause);
        this.statusCode = statusCode.getCode();
        this.message = message;
    }
}
